/**
 * Notes: 预约单实体 - 宠物门店预约小程序
 * Date: 2025-01-27 
 */

const BaseModel = require('./base_model.js');
class AppointmentModel extends BaseModel {}

// 集合名
AppointmentModel.CL = "ax_appointments";

AppointmentModel.DB_STRUCTURE = {
	_pid: 'string|true',
	_id: 'string|true|comment=预约单唯一ID',
	appointmentNumber: 'string|true|comment=预约单号',
	userId: 'string|true|comment=用户ID',
	petIds: 'array|true|comment=接受服务的宠物ID列表',
	storeId: 'string|true|comment=门店ID',
	serviceId: 'string|true|comment=预约的服务ID',
	employeeId: 'string|false|comment=预约的员工ID',
	deviceId: 'string|false|comment=预约的设备ID',
	
	appointmentTime: 'int|true|comment=预约的开始时间',
	appointmentEndTime: 'int|true|comment=预约的结束时间',
	status: 'int|true|default=101|comment=状态',
	totalAmount: 'int|true|comment=订单总金额(分)',
	payAmount: 'int|true|comment=实际支付金额(分)',
	payTime: 'int|false|comment=支付时间',
	
	contactName: 'string|false|comment=联系人姓名',
	contactPhone: 'string|false|comment=联系人电话',
	remarks: 'string|false|comment=备注信息',
	
	roomType: 'string|false|comment=房间类型',
	roomUnit: 'string|false|comment=房间收费单位',
	totalDays: 'int|false|comment=总天数',
	
	isDeleted: 'int|false|default=0|comment=是否已删除 0:未删除 1:已删除',
	
	createTime: 'int|true|comment=创建时间',
	updateTime: 'int|true|comment=更新时间',
}

// 字段前缀
AppointmentModel.FIELD_PREFIX = "";
AppointmentModel.ADD_ID = false;
AppointmentModel.UPDATE_TIME = false;
AppointmentModel.UPDATE_IP = false;

/**
 * 预约状态
 */
AppointmentModel.STATUS = {
	PENDING_PAY: 101,    // 待支付
	PAID: 201,           // 已支付/待服务
	IN_SERVICE: 301,     // 服务中
	COMPLETED: 302,      // 已完成
	CANCELLED: 401       // 已取消
};

AppointmentModel.STATUS_DESC = {
	PENDING_PAY: '待支付',
	PAID: '已支付/待服务',
	IN_SERVICE: '服务中',
	COMPLETED: '已完成',
	CANCELLED: '已取消'
};

module.exports = AppointmentModel;
